<?php

include_once(APP_URL.'protected/myUtil/JsonEncode.php');
class EchoUtil {

    public static function msgSuccess($retCode, $retMsg) {
        $array = (object)array(
            'retCode' => 1,
            'result' => $retMsg
        );
        return chJsonEncode($array);
    }
    
    public static function msgError($errorCode, $errorMsg) {
        $dataArray = array(
            'errorCode' => $errorCode,
            'errorMsg' => $errorMsg
        );
        $tmpDataArray=(object)array(
            'retCode'=>0,
            'result'=>$dataArray
        );
        return chJsonEncode($tmpDataArray);
    }

    public static function msgPushSuccess($msgType, $msgContent) {
        $array = (object)array(
            'msgType' => $msgType,
            'msgContent' => $msgContent
        );
        return chJsonEncode($array);
    }

    public static function retSuccChurl($retCode, $retMsg) {
        $array = (object)array(
            'retCode' => $retCode,
            'result' => $retMsg
        );
        return json_encode($array);
    }
    
    public static function retFailedChurl($errorCode, $errorMsg) {
        $dataArray = array(
            'errorCode' => $errorCode,
            'errorMsg' => $errorMsg
        );
        $tmpDataArray=(object)array(
            'retCode'=>0,
            'result'=>$dataArray
        );
        return json_encode($tmpDataArray);
    }
    
    public static function retSucc($retCode, $retMsg) {
        $array = (object)array(
            'retCode' => $retCode,
            'result' => $retMsg
        );
        return json_encode($array);
    }

    public static function retFailed($errorCode, $errorMsg) {
        $dataArray = array(
            'errorCode' => $errorCode,
            'errorMsg' => $errorMsg
        );
        $tmpDataArray=(object)array(
            'retCode'=>0,
            'result'=>$dataArray
        );
        return json_encode($tmpDataArray);
    }
    
}
	